package org.graduates.webapp.actions.utils;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.graduates.webapp.actions.BaseAction;
import org.projects.graduates.domain.Person;

@Action(results = { @Result(name = "success", type = "json") })
public class ExistShownameAction extends BaseAction {

	private static final long serialVersionUID = -3479199519817508921L;

	private boolean success = false;
	private boolean exist = true;

	private String showName;

	public String execute() {

		exist = Person.findBy(showName) == null ? false : true;
		success = true;

		return SUCCESS;
	}

	public void setShowName(String showName) {
		this.showName = showName;
	}

	public boolean isSuccess() {
		return success;
	}

	public boolean isExist() {
		return exist;
	}

}
